package app.fugema.shop.main.order.adapter;

import android.view.View;

import com.base.common.utils.DensityUtil;
import com.base.common.utils.LogUtil;
import com.base.common.utils.UIUtils;
import com.base.common.utils.ViewUtils;
import com.base.common.view.adapter.connector.BaseItemMultiType;
import com.base.common.view.adapter.connector.BaseViewHolder;
import com.jeremyliao.liveeventbus.LiveEventBus;

import app.fugema.shop.R;
import app.fugema.shop.constants.AppConstants;
import app.fugema.shop.databinding.ShopingConfirmOrderAddressItBinding;
import app.fugema.shop.main.order.model.SimpleAddressBean;
import app.fugema.shop.main.order.view.AddressManageActivity;

public class ShoppingOrderAddressHeadMultiType extends BaseItemMultiType<SimpleAddressBean, ShopingConfirmOrderAddressItBinding> {

    @Override
    public int getItemViewType() {
        return TYPE_HEAD;
    }

    @Override
    public int getLayoutId()
    {
        return R.layout.shoping_confirm_order_address_it;
    }

    @Override
    public void onBindViewHolder(ShopingConfirmOrderAddressItBinding binding, int position, BaseViewHolder viewHolder, SimpleAddressBean bean)
    {
        super.onBindViewHolder(binding, position, viewHolder, bean);
        if (position == 1)
        {
            binding.clItemView.getDelegate().setCornerRadius_BR(DensityUtil.getDimens(R.dimen.dp_10));
            binding.clItemView.getDelegate().setCornerRadius_BL(DensityUtil.getDimens(R.dimen.dp_10));
            ViewUtils.setViewMarginTop(binding.clItemView,0,DensityUtil.getDimens(R.dimen.dp_12));
        }
    }

    @Override
    public void onItemClick(View view, int onclickType, int position, SimpleAddressBean bean)
    {
        super.onItemClick(view, onclickType, position, bean);
        LogUtil.e("MultiType 选择地址");
        //UIUtils.showToastSafes("跳转 选择地址");
        AddressManageActivity.start(view.getContext(), true);
        //LiveEventBus.get(AppConstants.EventKey.CONFIRM_ORDER_CLICK,Integer.class).post(R.id.clItemView);
    }

}
